/**
 * @author: Loy 
 * @date: 2014-6-27-下午2:51:22
 */
package net.loyintean.pearlshell.base.service;

import net.loyintean.pearlshell.base.model.ICachable;

/**
 * an interface to read and write cache.
 * 
 * @author Loy
 * @version 2014-6-27.1.0.0
 */
public interface ICacheService<T extends ICachable> {

	/**
	 * read a model from cache by it's key.
	 * 
	 * @param key
	 *            the key for the model.
	 * @return an instance of model
	 */
	T read(String key);

	/**
	 * write a model into the cache.
	 * <p>
	 * the model#getKey() will used as it's key in cache. and itself is the
	 * value.
	 * 
	 * @param model
	 *            an instance contains key in cache, and it's the key itself.
	 */
	void wrtie(T model);
}
